27. Motion Model Probability II

pseudo_position (x) pre-pseudo_position delta position P(transition) bel(x_{t-1})" style="text-align:center;">bel(x_{t-1}) P(position)
7 1 6 1.49E-06 5.56E-02 8.27E-08
7 2 5 1.34E-04 5.56E-02 7.44E-06
7 3 4 4.43E-03 5.56E-02 2.46E-04
7 4 ? 5.40E-02 0.00E+00 0.00E+00
7 5 2 ? 0.00E+00 0.00E+00
7 6 1 3.99E-01 0.00E+00 0.00E+00
7 7 0 2.42E-01 ? 1.66E-03
7 8 -1 5.40E-02 1.79E-03 ?

Delta Position

QUESTION:

What is difference in position for an x of 7 and a pre-pseudo position of 4?

SOLUTION:

NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer

Transition Probability

QUESTION:

Use normpdf (bottom of page) to determine the transition probability for x = 7 and a pre-pseudo_position of 5, and a control parameter of 1, and a standard deviation of 1. The transition probability can be determined through normpdf(delta_position, control_parameter, position_stdev). The answer must be in scientific notation with two decimal place accuracy, for example 3.14E-15.

SOLUTION:

NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer

Determine the belief state

QUESTION:

In practice we only set our initial belief state, but making the following calculation is helpful in building intuition. What is the belief state bel(x_{t-1}) for the penultimate row of our table above? Write the answer in scientific notation with an accuracy of two decimal places, for example 3.14E-15.

SOLUTION:

NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer

Position Probability

QUESTION:

What is the discretized position probability for x = 7 and a pre-pseudo_position of 8, given the belief state in the table above? Write the answer in scientific notation with an accuracy of two decimal places, for example 3.14E-15.

SOLUTION:

NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer

We have completed our table of discretized calculation for each ith positon probability value. To determine the final probability returned by the motion model, we must sum the probabilities.

Aggregating Discretized P(position)

QUESTION:

Given the table above, what is the final probability returned by our motion model. Enter the answer in scientific notation with an accuracy of two decimal places, for example 3.14E-15.

SOLUTION:

NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer

Recall that the transition probability can be determined through norm_pdf(delta_position, control_parameter, position_stdev)

Start Quiz:

//=================================================================================
// Name        : help_functions.h
// Version     : 2.0.0
// Copyright   : Udacity
//=================================================================================

#include <iostream>
#include "help_functions.h"

//TODO: assign a value, the difference in distances between x_t and x_{t-1}
//for an x of 7 and a pre-pseudo position of 5

float value = ?;//YOUR VALUE HERE


float parameter = 1.0; //set as control parameter or observation measurement
float stdev = 1.0; //position or observation standard deviation

int main() {

    float prob = Helpers::normpdf(value, parameter, stdev);

    std::cout << prob << endl;

    return 0;
}
//=================================================================================
// Name        : help_functions.h
// Version     : 2.0.0
// Copyright   : Udacity
//=================================================================================

#ifndef HELP_FUNCTIONS_H_
#define HELP_FUNCTIONS_H_

#include <math.h>
#include <iostream>
#include <vector>

using namespace std;

class Helpers {
public:

	//definition of one over square root of 2*pi:
	constexpr static float STATIC_ONE_OVER_SQRT_2PI = 1/sqrt(2*M_PI) ;
	float ONE_OVER_SQRT_2PI = 1/sqrt(2*M_PI) ;

	/*****************************************************************************
	 * normpdf(X,mu,sigma) computes the probability function at values x using the
	 * normal distribution with mean mu and standard deviation std. x, mue and 
	 * sigma must be scalar! The parameter std must be positive. 
	 * The normal pdf is y=f(x;mu,std)= 1/(std*sqrt(2pi)) e[ -(x−mu)^2 / 2*std^2 ]
	*****************************************************************************/
	static float normpdf(float x, float mu, float std) {
	    return (STATIC_ONE_OVER_SQRT_2PI/std)*exp(-0.5*pow((x-mu)/std,2));
	}
	
};

#endif /* HELP_FUNCTIONS_H_ */

In the next concept we will implement the motion model in C++.

Reference Equations

  • Discretized Motion Model:
\sum\limits_{i} p(x_t|x_{t-1}^{(i)}, u_t, m)bel(x_{t-1}^{(i)})
  • Transition Model:
p(x_t|x_{t-1}^{(i)}, u_t, m)
  • 'i'th Motion Model Probability:
p(x_t|x_{t-1}^{(i)} u_t, m) *bel(x_{t-1}^{(i)})